<%--
  Created by IntelliJ IDEA.
  User: acer
  Date: 2024/9/19
  Time: 8:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" %>
<%@ page import="java.text.SimpleDateFormat" %>
<html>
<head>
  <meta charset="UTF-8">
    <title>留言审核 | application</title>
</head>
<body bgcolor="#abcdef">
<% Vector<String> v = new Vector<String>();
int i = 0;
%>
<%
  // 获取时间
  String datetime = new SimpleDateFormat("yyy-MMM-dd hh:mm:ss").format(Calendar.getInstance().getTime());

%>
<%
  //获取留言板提交的数据
  request.setCharacterEncoding("utf-8");
  String name = request.getParameter("name");
  String title = request.getParameter("title");
  String message = request.getParameter("message");
%>
<%
  //处理用户提交的数据
  if (name==null ||"".equals(name.trim())){
    //trim（）去取字符串中空格
    name = "网友"+(int)(Math.random()*100000+10000);
  }
  if (title==null ||"".equals(title.trim())){
    title = "无";
  }
  if (message==null ||"".equals(message.trim())) {
    message = "无";
  }
%>
<%
  i++;
  String str = "第" + "<sapn class=span0>" + i + "</span>"+ "楼"
          +".<span class=span1>留言人:</span>" +name + ".<span class=span2>标题:</span>"+title
          +".<span class=span4>时间:</span> " + datetime + ".<hr>";
  v.add(str);
  application.setAttribute("message",v);
%>
留言成功.
<a href="inputMessage.jsp"返回留言板></a>
</body>
</html>
